package com.atguigu.util;

import javax.servlet.http.HttpServletRequest;

/**
 * @ Author:任留辉
 * @ Description:
 * @ Date:Created in 20:46 2021/3/22 0022
 */
public class WebUtils {
    public static String getPath(HttpServletRequest request){
        //获取当前的请求路径
        String requestURI = request.getRequestURI();
        //获取当前请求路径后拼接的请求参数
        String queryString = request.getQueryString();
        if(queryString.contains("&pageNo")){
            queryString = queryString.substring(0, queryString.indexOf("&pageNo"));
        }
        return requestURI + "?" + queryString;
    }
}
